package com.wssnail.controller;


import com.wssnail.service.WxOfficeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author 熟透的蜗牛
 * @since 2022-09-28
 */
@RestController
public class WxOfficeController {
    @Autowired
    private WxOfficeService wxOfficeService;

    /*
     * @description: 微信处理消息
     * @author: 熟透的蜗牛
     * @date: 2022/10/9 17:00
     * @param signature
     * @param timestamp
     * @param nonce
     * @param echostr
     * @param request
     * @return: java.lang.String
     **/
    @PostMapping(value = "/xxx/onWxMsg", produces = "application/xml;charset=UTF-8")
    public String subscribeProcessor(@RequestParam(value = "timestamp", required = false) String timestamp,
                                     @RequestParam(value = "nonce", required = false) String nonce, HttpServletRequest request) {
        return wxOfficeService.handleMsg(timestamp, nonce, request);
    }
}

